#ifndef TVIEWDRAW_H_AABBUYTZX
#define TVIEWDRAW_H_AABBUYTZX

#include "../../../kegui_global.h"

#include "vhc/constview4fun.h"
#include "vhc/constview4id.h"
#include "MenuIdConvert.h"
#include <QPainter>

#define DRAW_ICON_Font(LFT,TOP,TXTSIZE,TXTID)   QFont &font_t = editContext->thirdFontIcon;  \
quint32 textColor = isEnable ?(isChecked ?  Color_Font_ToolBar_checked:Color_Font_ToolBar) : Color_Font_Unable;  \
    int cx0, cy0,ntLeft,ntTop;  \
    uint codeText = MenuIdConvert::GetIconTextByID(TXTID);  \
    QChar chTxt(codeText);  \
    QString szLabel(chTxt);  \
    font_t.setPointSize(TXTSIZE);  \
    cx0 = LFT + (childWidth >> 1);  \
    cy0 = TOP + (childHeight >> 1);  \
    ntLeft = cx0 - 1000;  \
    ntTop = cy0 - 500;  \
    if(isDeAct)  textColor = Color_Text_Deactivate;  \
  \
    QRect rect4Text(ntLeft, ntTop, 2000, 1000);  \
    QBrush brushText(QColor(QRgba64::fromArgb32(textColor)),Qt::SolidPattern);  \
    QPen penText(brushText,1, Qt::SolidLine);  \
    painter->setFont(font_t);  \
    painter->setBrush(Qt::BrushStyle::NoBrush);  \
    painter->setPen(penText);  \
    painter->drawText(rect4Text,Qt::AlignCenter,szLabel);


#define DRAW_ICON_FontR2(LFT,TOP,TXTSIZE,TXTCOLOR,TXTID)  QFont font_t = editContext->fontIcon;  \
int cx0, cy0,ntLeft,ntTop;  \
    uint codeText = MToolBar::GetIconTextByID(TXTID);  \
    QChar chTxt(codeText);  \
    QString szLabel(chTxt);  \
    font_t.setPointSize(TXTSIZE);  \
    cx0 = LFT + (childWidth >> 1);  \
    cy0 = TOP + (childHeight >> 1);  \
    ntLeft = cx0 - 1000;  \
    ntTop = cy0 - 500;  \
    QRect rect4Text(ntLeft, ntTop, 2000, 1000);  \
    QBrush brushText(QColor(QRgba64::fromArgb32(TXTCOLOR)),Qt::SolidPattern);  \
    QPen penText(brushText,1, Qt::SolidLine);  \
    painter->setFont(font_t);  \
    painter->setBrush(Qt::BrushStyle::NoBrush);  \
    painter->setPen(penText);  \
    painter->drawText(rect4Text,Qt::AlignCenter,szLabel);



#define DRAW_Text_Label(LFT,TOP,TXTSIZE,TXTID)   \
quint32 textColor = isDeAct && (nIdMouseOver != TXTID)  ? Color_Text_Deactivate : Color_Font_ToolBar;  \
    QString strLabel = MenuIdConvert::GetLabelByID(TXTID);  \
    int cx0, cy0,ntLeft,ntTop;  \
    cx0 = LFT + (childWidth >> 1);  \
    cy0 = TOP + (childHeight >> 1);  \
    ntLeft = cx0 - 1000;  \
    ntTop = cy0 - 500;  \
    QRect rect4Text(ntLeft, ntTop, 2000, 1000);  \
    QBrush brushText(QColor(QRgba64::fromArgb32(textColor)),Qt::SolidPattern);  \
    QPen penText(brushText,1, Qt::SolidLine);  \
    painter->setFont(editContext->fontLabel);  \
    painter->setBrush(Qt::BrushStyle::NoBrush);  \
    painter->setPen(penText);  \
    painter->drawText(rect4Text,Qt::AlignCenter,strLabel);




#define DefineColorTxt() bool isMouseOver = BoolFlagMouseOver == (BoolFlagMouseOver & boolFlag);  \
bool isEnable = BoolFlagEnable == (BoolFlagEnable & boolFlag);  \
    bool isChecked = BoolFlagChecked == (BoolFlagChecked & boolFlag);  \
    bool isDeAct = false == isMouseOver && BoolFlagDeactivate == (BoolFlagDeactivate & boolFlag);  \
    quint32 textColor = isEnable ?(isChecked ?  Color_Font_ToolBar_checked:Color_Font_ToolBar) : Color_Font_Unable;  \
    if(isDeAct)  textColor = Color_Text_Deactivate;


#define DefineColorTxtR2() DefineColorTxt();  \
quint32 focusColor = isEnable ?(isChecked ? Color_Font_ToolBar_checked:Color_Focus_ToolBar) : Color_Font_Unable;  \
    if(isDeAct)  focusColor = Color_Text_Deactivate;

#define Coords_EditTool_LineExtrude {-8.00f,-8.00f,-2.67f,-8.00f,-2.67f,1.92f,2.67f,1.92f,2.67f,-8.00f,8.00f,-8.00f,8.00f,8.00f,-8.00f,8.00f,-8.00f,-8.00f }


namespace kepen {
namespace core {

class KEGUI_EXPORT TViewDraw{

public:

    static void DrawCheckedTriFlag(QPainter* painter,int left, int top, int width,int height, quint32 boolFlag);


    static void DrawShapePickPoint(QPainter* painter,int left,int top,int width,int height, quint32 boolFlag);
    static void DrawShapePickLine(QPainter* painter,int left,int top,int width,int height,quint32 boolFlag);

    static void DrawMakeHolePolygon(QPainter* painter,int x,  int y,quint32 boolFlag);
    static void DrawShapePolygon(QPainter* painter,int x,  int y,quint32 boolFlag);
    static void DrawShapePolygonR2(QPainter* painter,int x,  int y, quint32 boolFlag);
    static void DrawEditToolVector(QPainter* painter,int x,  int y);
    static void DrawShapeCoords(QPainter* painter,quint32 boolFlag,float x,  float y,std::size_t length,float *coords);
    static void DrawShapeCircle(QPainter* painter,int x,  int y,int radius, quint32 boolFlag);
    static void DrawComboxFlag(QPainter* painter,int x,  int y, quint32 boolFlag);
    static void DrawBtnMinimize(QPainter* painter,int x,  int y,int radius, quint32 boolFlag);
    static void DrawBtnClose(QPainter* painter,int x,  int y,int radius, quint32 boolFlag);
    static void DrawLabelIcon(QPainter* painter,int left,  int y,int id, quint32 boolFlag);


private:
    TViewDraw(){}
    TViewDraw(const TViewDraw &single) = delete;
    const TViewDraw &operator=(const TViewDraw &single) = delete;
};

}
}

#endif // EVCOMMRENDER_H
